package com.wc.alorithm_blue_bridge._动态规划.线性DP.健身;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/1/7 17:57
 * @description
 * https://www.lanqiao.cn/problems/5130/learning/?problem_list_id=27&page=1
 */
public class Main {
    /**
     * 思路：
     * 动态规划, 检测 前 i - 2 ^ k 期间没有事, 用前缀和, 查到里面sum[i] - sum[i - 2 ^ k] = 0
     * 转移方程 f[i] = max{f[i], f[i - 2 ^ k] + s, f[i - 1]} 满徐 i >= 2 ^ k
     * f[i - 1]是不运动的
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 200010, M = 55;
    static int[] a = new int[N], base = new int[M], sum = new int[N];
    static int[] k = new int[M], s = new int[M];
    static long[] f = new long[N];
    static int n, m, q;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        q = sc.nextInt();

        while (q-- > 0) {
            int x = sc.nextInt();
            a[x]++;
        }
        for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
        for (int i = 1; i <= m; i++) {
            k[i] = sc.nextInt();
            s[i] = sc.nextInt();
        }
        base[0] = 1;
        for (int i = 1; i <= 20; i++) base[i] = base[i - 1] << 1;

        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (i >= base[k[j]] && sum[i] - sum[i - base[k[j]]] == 0) {
                    f[i] = Math.max(f[i], f[i - base[k[j]]] + s[j]);
                }
            }
           f[i] = Math.max(f[i], f[i - 1]);
        }
        out.println(f[n]);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

